<%@page import="com.shsh.safemanage.model.Department3"%>
<%@page import="com.shsh.safemanage.model.Department2"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<%
{
Long theDepart1ID = 0L;
Long theDepart2ID = 0L;

User theRegisterUser = (User) session.getAttribute(Constants.SESSION_REGISTER_USER);
Long depart3ID = 0L;
if (theRegisterUser != null) {
	theDepart1ID = theRegisterUser.getDepartment1ID();
	theDepart2ID = theRegisterUser.getDepartment2ID();
	depart3ID = theRegisterUser.getDepartment3ID();
}

String depart1IDStr = request.getParameter(Constants.REQUEST_PARAMETER_DEPARTMENT1ID);
String depart2IDStr = request.getParameter(Constants.REQUEST_PARAMETER_DEPARTMENT2ID);
try {
	theDepart1ID = new Long(depart1IDStr);
	theDepart2ID = new Long(depart2IDStr);
} catch (Exception e) {
}

DepartmentDao departDao = DaoCreator.createDepartmentDao();
List<Department3> depart3List = departDao.getDepartment3ListByDepartment12ID(theDepart1ID, theDepart2ID);
%>
<select id="depart3">
<%
for (Department3 depart3: depart3List) {
%>
	<option value="<%=depart3.getId()%>" <%=depart3ID.equals(depart3.getId())? "selected":""%> ><%=depart3.getDepartment3Name()%></option>
<%
}
%>
</select>
<%
}
%>
